#ifndef QMODELSAVER_H
#define QMODELSAVER_H

#include <QFile>
#include <QPointF>
#include <QRectF>
#include <QString>
#include <QtXml>

#include "cell.h"
#include "node.h"
#include "edge.h"
#include "area.h"

//! Saver class.
/*!
  QMaodelSaver implements saving and loading capabilities for the model.
  Model can be saved in xml format or be exported into plain text.
  It can be loaded from previously saved xml or imported from *.node file or *.node+*.edge file pair.
  */
class QModelSaver: public QXmlDefaultHandler
{
private:
    CELL cell;

protected:

public:
    explicit QModelSaver(void);

    bool startElement(const QString &, const QString &, const QString &name, const QXmlAttributes &attrs);

    CELL &getCell(void);

    void saveXmlModel(const CELL &_cell, const QString &fileName);

    void importPlainTextModel(const QString &fileName);
    void exportPlainTextModel(const CELL& _cell, const QString &fileName);
};

#endif // QMODELSAVER_H
